UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gPvhWO5DjgmuD1a+/rA0gR2PVuchbHO8Gkfsa4nMtrE=' 
WHERE 
  key_id = '58493772b231a4c84f054ebde03cd2bfbe3fd0166718b0e1c79d5ffce4bbab82' 
  AND (
    token = 'gPvhWO5DjgmuD1a+/rA0gR2PVuchbHO8Gkfsa4nMtrE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031