UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3J7piUDUDhNlvj+B+54mjgiGTlRXtiaB55bSHCHsPmc=' 
WHERE 
  key_id = '3e932552d1d58427fa3f8803c2a11600150efc846e4f28f6cd762e24ed2d5877' 
  AND (
    token = '3J7piUDUDhNlvj+B+54mjgiGTlRXtiaB55bSHCHsPmc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040