UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E51BV2F5CtT0nYUCWGa847GJIJ9Wyn3CUdmiZArEMtU=' 
WHERE 
  key_id = '7088f41d0ca479e49eb19b4b45786a593b7aec3ec33166eb22149ace448486d4' 
  AND (
    token = 'E51BV2F5CtT0nYUCWGa847GJIJ9Wyn3CUdmiZArEMtU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022