UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x0ujzjXnjwD5k82N7zfW9zALIUEdEr72w+eHbPus8AA=' 
WHERE 
  key_id = 'f1d238e786307bf3a1344d57d58f6314c72d63abce41ad087a7f07e73e0e2a7a' 
  AND (
    token = 'x0ujzjXnjwD5k82N7zfW9zALIUEdEr72w+eHbPus8AA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050