UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YLks3fIagauK6zm9NQHXBytdFhD9TugNhNN/SGoesK4=' 
WHERE 
  key_id = '226d631634e4050c025b6857b5978b4b6f5d17d5ede8ca0b34fc0f1da4f2ed2f' 
  AND (
    token = 'YLks3fIagauK6zm9NQHXBytdFhD9TugNhNN/SGoesK4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030