UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ioPzDCII0apVn6kssh8IlUVNxj60nNk5eJZYFcreoZE=' 
WHERE 
  key_id = '34c7037abbf4d8cfbef404b47d8accda8973a7ee939e9bab7004722969836da0' 
  AND (
    token = 'ioPzDCII0apVn6kssh8IlUVNxj60nNk5eJZYFcreoZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017