UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tUfdiaq5E+k8MB5MjO2bJiffUip7YjFn6FtIi4w3yds=' 
WHERE 
  key_id = '2baeba140ad45ccd2dd3155abf42d99081ad525498079a0e1acc5ba9962172d1' 
  AND (
    token = 'tUfdiaq5E+k8MB5MjO2bJiffUip7YjFn6FtIi4w3yds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042