UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O5CVwUy6yoA+FPBozxDEDQfCeJqqjn7FFyBURlnSIhs=' 
WHERE 
  key_id = 'c9b3da89b80faca25029eb2c0effe55994708d6dcdc9b575ae0ddedaf6852584' 
  AND (
    token = 'O5CVwUy6yoA+FPBozxDEDQfCeJqqjn7FFyBURlnSIhs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026