UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ESsTaIPLLwKb0Pdso63J+lEcOqpp+Csd/zf+ewwP+FM=' 
WHERE 
  key_id = '5671adb11d3663c1529dd8c1a127babc023cb7395f5fda022d94a73f9417c6c1' 
  AND (
    token = 'ESsTaIPLLwKb0Pdso63J+lEcOqpp+Csd/zf+ewwP+FM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036