UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IfjGtpJvsoQZcFWa99TKUXKafW4et0w+Dc4id+joqGM=' 
WHERE 
  key_id = '71e479bc52723f9de7e9f842ba0d028a94c90e21c1a4dbf4153ffb2772c556fa' 
  AND (
    token = 'IfjGtpJvsoQZcFWa99TKUXKafW4et0w+Dc4id+joqGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032