UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pv0cK78sMqSjI0uGK1iNp2zID55Rzic980nFbIGxPrQ=' 
WHERE 
  key_id = '2b49ea2ca1beea024526189e0abf67d516cd8a54238252119dd5b5266d2d12e1' 
  AND (
    token = 'pv0cK78sMqSjI0uGK1iNp2zID55Rzic980nFbIGxPrQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016