UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CG5G5ATK1fJ00XpBT8SxdHm2ZBL0C+iTVBYp2KX7OZg=' 
WHERE 
  key_id = 'ec60eb9b67f7a04b95460913f6e599555d89f885bff0eb9bc017afa601dd596b' 
  AND (
    token = 'CG5G5ATK1fJ00XpBT8SxdHm2ZBL0C+iTVBYp2KX7OZg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034