UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5RDCQMYam3wnh+5EI2A3his1UUZcXWPaWcdzMy+8fns=' 
WHERE 
  key_id = '6af14f2bf562722856777674a38c9e2b8e4d76bb4bd61277c9946bab3477985d' 
  AND (
    token = '5RDCQMYam3wnh+5EI2A3his1UUZcXWPaWcdzMy+8fns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020