UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p8bOtWUtWXLsYuaKb++EukCNxWcZjwkKUrv0h2x/N+I=' 
WHERE 
  key_id = '8760378628caecac0579f435314eeddf74ba59e3d0eb869913b50ad1911d2887' 
  AND (
    token = 'p8bOtWUtWXLsYuaKb++EukCNxWcZjwkKUrv0h2x/N+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025