UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wvkv7WiiPEAB9BdQ1dY9H6plX06n+wx7eWw5aq7Rwtc=' 
WHERE 
  key_id = 'df033e6305d1cc3250fbace15ee788e01a227df8cb00efc178b199b17da2fc9d' 
  AND (
    token = 'Wvkv7WiiPEAB9BdQ1dY9H6plX06n+wx7eWw5aq7Rwtc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033