UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vG5yRKXTu1J4mkW0BoCOw+n4TRVsHln4PbgM2Q60LLg=' 
WHERE 
  key_id = '674c4e7c623cd809384fda6a65357bddbfb6bb2de03c81dcf43962c46afe4437' 
  AND (
    token = 'vG5yRKXTu1J4mkW0BoCOw+n4TRVsHln4PbgM2Q60LLg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025