UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VbcXbJKz73usHhk1dh0Q3LZL+OCcAC9ibKcs1+3vIRo=' 
WHERE 
  key_id = '889e02a85cd68754706ada4e6620cda56ffc655c206009a796bc57b2259baf57' 
  AND (
    token = 'VbcXbJKz73usHhk1dh0Q3LZL+OCcAC9ibKcs1+3vIRo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034