UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lruV2YD9pVWFOoCds/PzwbU48AdHb2DEkHYAinY/lzM=' 
WHERE 
  key_id = 'd5b1afc355d60a085861d0b25ca1046eab5428c8bb950693457159c76cafde40' 
  AND (
    token = 'lruV2YD9pVWFOoCds/PzwbU48AdHb2DEkHYAinY/lzM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016