UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8Gg2E7bGFkF6xw7vJ8HOJ1bRPgKJPTCb36WFHRaFEn4=' 
WHERE 
  key_id = '72002e3c14aa52399e3b1cbe833d46ef48d75fd4d66847ac67fa414d8134262d' 
  AND (
    token = '8Gg2E7bGFkF6xw7vJ8HOJ1bRPgKJPTCb36WFHRaFEn4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026