UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SL3ae44IkaoNTg8W8+1XTVcBIVLwb+3+kV2iXD+MuUA=' 
WHERE 
  key_id = '569651142edc995b1baa4e6ec4068df55d8fe6f35fe4a363f8218fbfd3f0dae5' 
  AND (
    token = 'SL3ae44IkaoNTg8W8+1XTVcBIVLwb+3+kV2iXD+MuUA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030