UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JclhKzUPDTag2vVODJtzCiM8TS3RqjhWEiKCTebcihw=' 
WHERE 
  key_id = 'fa92a9d9e6034948c331da5847841167184f17d820107982ce69ee4159bf103e' 
  AND (
    token = 'JclhKzUPDTag2vVODJtzCiM8TS3RqjhWEiKCTebcihw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034