UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QlBpNoSq2kOISiRV2elxxalX3dYexUephPgymWMXhIg=' 
WHERE 
  key_id = '6997149a903acdc4d9371632449d52258213f8e42d925438d68d679bc95329fd' 
  AND (
    token = 'QlBpNoSq2kOISiRV2elxxalX3dYexUephPgymWMXhIg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042