UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jHx82OPQ1HhCMx1k2nzU0nQ12ghmmgqyzwhh2dRIvq0=' 
WHERE 
  key_id = '843d7b9b42d708d7b60d5e59e41585634d1d911f148acbb96bd0385978844560' 
  AND (
    token = 'jHx82OPQ1HhCMx1k2nzU0nQ12ghmmgqyzwhh2dRIvq0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00072