UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n1Uvr/r8KCSGAN8W0hViwwTY6jgbESVVAF6CjVlvkmM=' 
WHERE 
  key_id = '47eb63ceaaa91dd31d46786f91a862523de016c1d3fee1de39edc3286f6d4b20' 
  AND (
    token = 'n1Uvr/r8KCSGAN8W0hViwwTY6jgbESVVAF6CjVlvkmM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036