UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WjPkTbdg10r5uVLu/KOlcIpVoMBWIulac9BLxQme9/Q=' 
WHERE 
  key_id = '4c1b4a908d73feff839bb9101bdc7df9639dc2701bd81893a1d61f9a537b386c' 
  AND (
    token = 'WjPkTbdg10r5uVLu/KOlcIpVoMBWIulac9BLxQme9/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041