UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KSxBhNT4Qi1Cg64EW/tVmUkR4t57NmV5//qfETw3Tag=' 
WHERE 
  key_id = 'c87b8369c1a44fa190155c84db937fdf73f1a55188445882996e30dc073dad3f' 
  AND (
    token = 'KSxBhNT4Qi1Cg64EW/tVmUkR4t57NmV5//qfETw3Tag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024