UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gXlufp63jOmjOcj1rOnJeu+psdtn5DwnjADXqKf5Azk=' 
WHERE 
  key_id = 'affa11d785467917760961e8c27be52dda118020d3d8efb56596dbbf70ceb205' 
  AND (
    token = 'gXlufp63jOmjOcj1rOnJeu+psdtn5DwnjADXqKf5Azk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018