UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nI6RHxETdxHeqwm27Va/xts5soHeu7a0PrbdZBHyVLU=' 
WHERE 
  key_id = '97067ecc5e412a8c882eae0e4a7b3fde903d757c13063c66cdd2c1410aeedc34' 
  AND (
    token = 'nI6RHxETdxHeqwm27Va/xts5soHeu7a0PrbdZBHyVLU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029