UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x9yE+xjKpoq1qQkMawi7hWJ6uEKS4FxL5cCoT5Vfvwg=' 
WHERE 
  key_id = '77690f56d4ba3b83838e5c1a486238ebde1cb52708ab0262b41525d709349fcc' 
  AND (
    token = 'x9yE+xjKpoq1qQkMawi7hWJ6uEKS4FxL5cCoT5Vfvwg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048